package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EdutHouseIntegration;
import com.jwsoft.manager.common.vo.edutHouse.EdutHouseVO;
import com.jwsoft.manager.common.vo.edutHouse.EdutHouseKeyVO;
import com.jwsoft.manager.common.vo.edutHouse.EdutHouseQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 房产信息备份表网关
 *
 * @author zhiyuan
 * @since 2023-09-20
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "房产信息备份表", description = "房产信息备份表")
public class EdutHouseController {

    @Autowired
    public EdutHouseIntegration edutHouseIntegration;

    @Operation(summary = "房产信息备份表分页查询",description = "房产信息备份表分页查询")
    @PostMapping(value = "/edutHouse0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EdutHouseVO>> getList(@RequestBody @Validated EdutHouseQueryVO vo) {
        return AppResponse.successData(edutHouseIntegration.getList(vo));
    }

    @Operation(summary = "房产信息备份表根据主键查询详情",description = "房产信息备份表根据主键查询详情")
    @PostMapping(value = "/edutHouse0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EdutHouseVO> getById(@RequestBody @Validated EdutHouseKeyVO vo) {
        return AppResponse.successData(edutHouseIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息备份表新增",description = "房产信息备份表新增")
    @PostMapping(value = "/edutHouse0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EdutHouseVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EdutHouseVO vo) {
        return AppResponse.successData(edutHouseIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息备份表修改",description = "房产信息备份表修改")
    @PostMapping(value = "/edutHouse0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EdutHouseVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EdutHouseVO vo) {
        return AppResponse.successData(edutHouseIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息备份表删除",description = "房产信息备份表删除")
    @PostMapping(value = "/edutHouse0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EdutHouseKeyVO vo) {
        edutHouseIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
